<!--#include virtual="/includes/core-functions.asp"-->
<%
Response.Buffer=true
Dim MBRequest
Dim strPath, user
strPath = "script:" & Server.MapPath("/includes/MetaBuilders.FileUp.wsc" )
set MBRequest = GetObject( strPath )
If MBRequest("submit") = "upload" then
'	Response.Write "You Uploaded: " & MBRequest("File1").Path & MBRequest("File1").FileName & "<br>" & vbNewLine
'	Response.Write "The Extension Is: " & MBRequest("File1").Extension & "<br>" & vbNewLine
'	Response.Write "The MIME/ContentType Is: " & MBRequest("File1").ContentType & "<br />"
'	Response.Write MBRequest("File1").Path
	if session("u_level") = 10 then
		user = MBRequest("ui")
		else
		user = session("u_id")
	end if
	'delete old avatar
	remAvatar user
	'upload new one
	MBRequest("File1").Overwrite = true
	MBRequest("File1").SavePath = Server.MapPath("/") & "\public\avatars\"
	MBRequest("File1").SaveAs(user & "." & MBRequest("File1").Extension )
	
	Response.Write MBRequest("File1").SavePath
	
End if
set MBRequest = Nothing

if Session("u_level") = 10 and instr(request.ServerVariables("HTTP_REFERER"),"user-edit")> 0 then
	Response.Redirect "/admin/user-edit.asp?id=" & user
	else
	Response.Redirect "/profile.asp?msg=Avatar Updated."
end if
%>